[#-- freemarker menu demo --]

<script type="text/javascript">

</script>

						[#--
						<ul>
	                    	<li class="current"><a href="dashboard.html" class="dashboard"><span>Dashboard</span></a></li>
	                        <li><a href="widgets.html" class="widgets"><span>Widgets</span></a></li>
	                        <li><a href="tables.html" class="tables"><span>Tables</span></a></li>
	                        <li><a href="elements.html" class="elements"><span>Elements</span></a></li>
	                        <li><a href="charts.html" class="charts"><span>Graphs &amp; Charts</span></a></li>
	                        <li><a href="media.html" class="media"><span>Media</span></a></li>
	                        <li><a href="form.html" class="editor menudrop"><span>Forms</span></a>
	                        	<ul>
	                            	<li><a href="form.html"><span>Form Styling</span></a></li>
	                            	<li><a href="editor.html"><span>WYSIWYG Editor</span></a></li>
	                                <li><a href="wizard.html"><span>Wizard</span></a></li>
	                            </ul>
	                        </li>
	                        <li><a href="grid.html" class="grid"><span>Grid</span></a></li>
	                        <li><a href="calendar.html" class="calendar"><span>Calendar</span></a></li>
	                        <li><a href="buttons.html" class="buttons"><span>Buttons &amp; Icons</span></a></li>
	                        <li><a href="chat.html" class="chat"><span>Chat Support</span></a></li>
	                        <li><a href="404.html" class="error"><span>Error Pages</span></a></li>
	                    </ul>
	                    --]
	                    <ul>
	                    [#list menu.subComponents as component]
							[@buildNode child=component.subComponents parent=component /]
	                    [/#list]
	                    </ul>                 

				[#macro buildNode child parent]
					[#-- 增加权限判断--]
					[#if displayer.hasPermission(parent)]
						<li [#if displayer.parser(parent)]class="current"[/#if]><a href="${parent.url}" title="${parent.description}" class="${parent.css!''} [#if child?? && child?size gt 0]menudrop[/#if]"><span>${displayer.getMessage("${parent.title}")}</span></a>
					    [#if child?? && child?size gt 0]
							<ul>
							[#list child as t]
								[#if t.subComponents?? && t.subComponents?size gt 0]
									[@buildNode child=t.subComponents parent=t/]
								[#else]
									[#if displayer.hasPermission(t)]
										[#--不存在儿子节点,则不需要递归,只生成父亲节点数据--]
										<li>[#if displayer.parser(t)]<div class="current"></div>[/#if]<a href="${t.url}" title="${t.description}" class="${t.css!''}"><span>${displayer.getMessage("${t.title}")}</span></a></li>
									[/#if]
								[/#if] 
							[/#list]
							</ul>
					    [/#if]
					    </li>
					[/#if]
				[/#macro]
